/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.upn.sigemfi.rec.be;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Diego
 */
@Entity
@Table(name = "REC_CONDONACION")
@NamedQueries({@NamedQuery(name = "Condonacion.findAll", query = "SELECT c FROM Condonacion c"),
@NamedQuery(name = "Condonacion.findByMontoDeuda", query = "SELECT c FROM Condonacion c WHERE c.montoDeuda = :montoDeuda"), @NamedQuery(name = "Condonacion.findByMontoPagado", query = "SELECT c FROM Condonacion c WHERE c.montoPagado = :montoPagado"), @NamedQuery(name = "Condonacion.findByFechaConcesion", query = "SELECT c FROM Condonacion c WHERE c.fechaConcesion = :fechaConcesion"), @NamedQuery(name = "Condonacion.findByObservacion", query = "SELECT c FROM Condonacion c WHERE c.observacion = :observacion")})
@PrimaryKeyJoinColumn(name = "ID_CONDONACION", referencedColumnName = "ID_PROCESO_COBRANZA")
@DiscriminatorValue(value = "COND")
public class Condonacion extends ProcesoCobranza implements Serializable {
    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @Column(name = "MONTO_DEUDA", precision = 53)
    private Double montoDeuda;
    @Column(name = "MONTO_PAGADO", precision = 53)
    private Double montoPagado;
    @Column(name = "FECHA_CONCESION")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaConcesion;
    @Column(name = "OBSERVACION", length = 255)
    private String observacion;
    @JoinColumn(name = "ID_CONDONACION", referencedColumnName = "ID_PROCESO_COBRANZA", nullable = false, insertable = false, updatable = false)
    @OneToOne(optional = false, fetch = FetchType.LAZY)
    private ProcesoCobranza procesoCobranza;

    public Condonacion() {
    }


    public Double getMontoDeuda() {
        return montoDeuda;
    }

    public void setMontoDeuda(Double montoDeuda) {
        this.montoDeuda = montoDeuda;
    }

    public Double getMontoPagado() {
        return montoPagado;
    }

    public void setMontoPagado(Double montoPagado) {
        this.montoPagado = montoPagado;
    }

    public Date getFechaConcesion() {
        return fechaConcesion;
    }

    public void setFechaConcesion(Date fechaConcesion) {
        this.fechaConcesion = fechaConcesion;
    }

    public String getObservacion() {
        return observacion;
    }

    public void setObservacion(String observacion) {
        this.observacion = observacion;
    }

    public ProcesoCobranza getProcesoCobranza() {
        return procesoCobranza;
    }

    public void setProcesoCobranza(ProcesoCobranza procesoCobranza) {
        this.procesoCobranza = procesoCobranza;
    }


    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ProcesoCobranza)) {
            return false;
        }
        ProcesoCobranza other = (ProcesoCobranza) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.rec.be.ProcesoCobranza[idProcesoCobranza=" + id + "]";
    }
}
